<template>
  <div>
    <!-- 面包屑导航组见 -->
    <MBX text="权限管理" text1="权限列表"></MBX>
    <!-- 卡片视图开始 -->
    <el-card>
      <!-- 表格开始 -->
      <el-table :data="RightList" border stripe style="width: 100%">
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column prop="authName" label="权限名称"></el-table-column>
        <el-table-column prop="path" label="路径"></el-table-column>
        <el-table-column prop="level" label="权限等级">
          <!-- 具名插槽 -->
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level=='0'">标签一</el-tag>
            <el-tag type="success" v-if="scope.row.level=='1'">标签二</el-tag>
            <el-tag type="warning" v-if="scope.row.level=='2'">标签三</el-tag>
          </template>
          <!-- 具名插槽 -->
        </el-table-column>
      </el-table>
      <!-- 表格结束 -->
    </el-card>
    <!-- 卡片视图结束 -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      RightList: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    async getData() {
      const { data: res } = await this.$http.get('rights/list')
      if (res.meta.status !== 200) {
        return this.$message.error('权限列表获取失败')
      }
      this.RightList = res.data
    }
  }
}
</script>

<style lang="less" scoped>
</style>
